package com.rollCall.controller;

import com.rollCall.entity.vo.CheckInPageResVo;
import com.rollCall.entity.vo.CheckInVo;
import com.rollCall.entity.result.Result;
import com.rollCall.entity.vo.CheckInfoVo;
import com.rollCall.service.CheckInService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author LiZhiHan
 * @date 2025/2/28
 */
@RestController
@RequestMapping("/admin/checkIn")
@RequiredArgsConstructor
@Slf4j
public class CheckInController {
	private final CheckInService checkInService;

	/**
	 * 添加签到
	 * @param checkInVo 签到信息
	 */
	@PostMapping("/add")
	public Result<Void> addCheckIn(@RequestBody CheckInVo checkInVo) {
		checkInService.addCheckIn(checkInVo);
		return Result.success();
	}

	/**
	 * 获取签到列表
	 * @return 分页结果
	 */
	@GetMapping("/list")
	public Result<List<CheckInPageResVo>> list() {
		return Result.success(checkInService.list());
	}

	/**
	 * 获取签到详情
	 * @param id id
	 * @return 签到详情
	 */
	@GetMapping("/{id}")
	public Result<CheckInfoVo> getCheckInById(@PathVariable Long id) {
		return Result.success(checkInService.getCheckInById(id));
	}
}
